<template>
  <div class='container'>
    <el-dialog :visible="showChk" title="题目审核" width="400px" @close="close">
        <div>
          <el-radio-group v-model="radioFn">
            <el-form ref="chkForm">
              <el-form-item>
                <el-radio label="1">通过</el-radio>
                <el-radio label="2">拒绝</el-radio>
              </el-form-item>
              <el-form-item>
                <el-input v-model="chkTextarea" size="mini" type="textarea" placeholder="请输入审核意见" style="width:350px"></el-input>
              </el-form-item>
            </el-form>
            <el-row type="flex" align="middel" justify="end" style="margin-top:30px">
              <el-col :span="10">
                <el-button size="small" @click="close">取消</el-button>
                <el-button size="small" type="primary" @click="submit">确定</el-button>
              </el-col>
            </el-row>
          </el-radio-group>
        </div>
      </el-dialog>
  </div>
</template>

<script>
import { choiceCheck } from '@/api/hmmm/questions'
export default {
  data () {
    return {
      radioFn: '1',
      chkTextarea: ''
    }
  },
  props: {
    showChk: {
      type: Boolean,
      default: false
    },
    chkId: {
      type: Number
    }

  },
  methods: {
    // 点击审核确定
    async submit () {
      try {
        const res = await choiceCheck({
          id: this.chkId,
          chkState: +this.radioFn,
          chkRemarks: this.chkTextarea
        })
        console.log(res)
        this.$message.success('审核成功')
        this.$emit('submit')
        this.close()
      } catch (error) {
        this.$message.error('审核失败')
      }
    },
    // 点击审核取消
    close () {
      this.$emit('update:showChk', false)
      this.chkTextarea = ''
    }
  }
}
</script>

<style scoped lang='less'></style>
